#include "employer.h"
#include <string>
#include <fstream>


using namespace std;


// Allow us to send Employer objects to an ostream...
ostream& operator<<(ostream& out, const Employer& empr) {

  out << empr.name_ << endl;

  return(out);
}

// Allow us to send Employee objects to an ostream...
ostream& operator<<(ostream& out, const Employee& emp) {

  out << emp.firstName_ << endl;
  out << emp.lastName_ << endl;
  if (emp.empr_){
    out << *emp.empr_ << endl;
  }

  return(out);
}

int main( ) {

  Employee emp;
  string first = "William";
  string last = "Shatner";
  Employer empr;
  string name = "Enterprise";
  empr.setName(name);

  emp.setFirstName(first);
  emp.setLastName(last);
  emp.setEmployer(empr);

  cout << emp;  // Write to the stream

  ofstream myfile;
  myfile.open ("example.txt");
  myfile << "Writing this to a file.\n";
  myfile << emp;
  myfile.close(); 
  
}

